package com.lzpu.thymeleafproject.demos.jobs;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 工作类，实现Job接口
 */
public class PrintJob implements Job {
    //执行的工作代码，编写具体的业务逻辑
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        //打印当前的执行时间，格式为：2000-01-01 00:00:00
        Date date = new Date();
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        System.out.println("当前的时间为：" + sf.format(date));
        System.out.println("Hello PrintJob!");
    }
}
